
class VersionItem:
    """版本对应的数据"""

    def __init__(self, appname:str, version: str, docname: str):
        """初始化"""
        self.appname = appname
        self.version = version
        self.docname = docname
        pass

    def get_manifest_url(self, isDebug=True):
        """获取manifest url"""
        domain = "https://app-distribution-1310744949.cos.ap-shanghai.myqcloud.com/"
        return domain + self.get_version_path(isDebug) + "/manifest.plist"
        pass

    def get_ipa_url(self, isDebug=True):
        """获取ipa url"""
        domain = "https://app-distribution-1310744949.cos.ap-shanghai.myqcloud.com/"
        return domain + self.get_version_path(isDebug) + "/" + self.appname + ".ipa"

    def get_version_path(self, isDebug=True):
        """获取对应的版本路径"""
        type = "debug"
        if not isDebug:
            type = "release"
        return self.docname + "/" + type + "/" + self.version

    def get_download_url(self, isDebug=True):
        """获取下载链接"""
        return "itms-services://?action=download-manifest&url=" + self.get_manifest_url(isDebug)

if __name__ == "__main__":

    v1 = VersionItem("LUKA", "v3.3.0", "luka-ios")
    ipa_url = v1.get_ipa_url()
    manifest_url = v1.get_manifest_url()
    print(ipa_url, manifest_url)
    pass